#ifndef B2D_PREREQUISITES_H
#define B2D_PREREQUISITES_H


#include "Platform.h"
#include "b2dTypes.h"
#include <string>
#include <stdint.h>
#include <memory>

// C functions
#if defined(__cplusplus)  // always defined by C++ compilers, never by C
	#define CFUNCTION "C"
#else
	#define CFUNCTION
#endif

// Export / import
#define B2D_EXPORT

// Mark public methods so that it is clear that they
// should not be called directly
#define _internal public

// API dll
#define B2D_API 

NS_B2D_BEGIN

// Temporary
#define TRANSLATABLE(x) x


// Deleting safely
// Delete object ( new object )
template<typename T>
FORCE_INLINE void SafeDelete(T*& ptr)
{
	delete ptr;
	ptr = nullptr;
}
template<typename T>
FORCE_INLINE void SafeDelete(T*&& ptr)
{
	delete ptr;
}

// Delete array ( new object[] )
template<typename T>
FORCE_INLINE void SafeDeleteArray(T*& ptr)
{
	delete[] ptr;
	ptr = nullptr;
}
template<typename T>
FORCE_INLINE void SafeDeleteArray(T*&& ptr)
{
	delete[] ptr;
}

NS_B2D_END


// Make class static
#define B2D_STATIC_CLASS(classname) \
private: \
    classname(void) {} \
    classname(const classname&) {} \
    ~classname(void) {} \
    const classname& operator= (const classname&);

// Make interface
#define B2D_INTERFACE(classname) \
public: \
    virtual ~classname(void) {} \
protected: \
    classname(void) {} 

// Quick hashing function
template<typename T>
FORCE_INLINE size_t hash_function(const T& s)
{
	std::hash<T> hash;
	return hash(s);
}


#endif